From: Florian Müllner Date: Fri, 22 Jun 2012 15:44:15 +0000 (+0200) Subject: remoteSearch: Parse 'DesktopId' field in key file X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~6416 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=bc91b7dcaec48f69d51685b41dec0f79c1b194a1;p=gnome-shell.git remoteSearch: Parse 'DesktopId' field in key file We strongly expect applications to use the same values for the 'Title'/'Icon' fields in their search provider .ini file as the 'Name'/'Icon' fields in their .desktop file. Rather than requiring applications to duplicate those fields, allow them to specify a 'DesktopId' field instead to point to the corresponding .desktop file, which makes it possible to ship search provider files without translatable strings (which is nice given that merging translations into search provider files lacks a standard rule). https://bugzilla.gnome.org/show_bug.cgi?id=678816 --- diff --git a/js/ui/remoteSearch.js b/js/ui/remoteSearch.js index 6a03607ee..bf391d24c 100644 --- a/js/ui/remoteSearch.js +++ b/js/ui/remoteSearch.js @@ -62,12 +62,26 @@ function loadRemoteSearchProvidersFromDir(dir, addProviderCallback) { let remoteProvider, title; try { let group = KEY_FILE_GROUP; - let iconName = keyfile.get_string(group, 'Icon'); let busName = keyfile.get_string(group, 'BusName'); let objectPath = keyfile.get_string(group, 'ObjectPath'); - title = keyfile.get_locale_string(group, 'Title', null); - let icon = new Gio.ThemedIcon({ name: iconName }); + let appInfo = null; + try { + let desktopId = keyfile.get_string(group, 'DesktopId'); + appInfo = Gio.DesktopAppInfo.new(desktopId); + } catch (e) { + } + + let icon; + if (appInfo) { + icon = appInfo.get_icon(); + title = appInfo.get_name(); + } else { + let iconName = keyfile.get_string(group, 'Icon'); + icon = new Gio.ThemedIcon({ name: iconName }); + title = keyfile.get_locale_string(group, 'Title', null); + } + remoteProvider = new RemoteSearchProvider(title, icon, busName,